<p id="notice"><%= notice %></p>

<center>
<p>
<h2>
  <%= @patient.name %>(<%= @patient.gender %>) (<%= link_to 'Edit', edit_patient_path(@patient) %>)
<br><br>
HIV Status:  <%= @patient.hiv_status %>
<br><br>
  <%= @patient.phone_number %>
</h2>
</p>

<% if @patient.deceased %>
<p>
  <font color="red">
  <b>Deceased on </b> <%= @patient.date_died %>
  </font>
</p>
<% end %>
<br/><br/>
<center>

  <h2>Appointments (<%= link_to 'create new', new_appointment_path(:patient_id => @patient.id) %>)</h2>
<table border=1>
<tr>
  <th>Date</th>
  <th>Showed up</th>
  <th>Notes</th>
  <th>Action</th>
</tr>
<% @appointments.each do |appointment| %>
  <tr>
    <td><%= appointment.appointment_date %></td>
    <td><%= appointment.showed_up %></td>
    <td><%= appointment.notes %></td>
    <td><%= link_to 'Edit', edit_appointment_path(appointment) %> </td>
  </tr>
<% end %>
</table>

<h2>Treatments (<%= link_to 'create new', new_treatment_path(:patient_id => @patient.id) %>)</h2>
<table border=1>
<tr>
  <th>Drug name</th>
  <th>Daily pills</th>
  <th>Debut Date</th>
  <th>Until</th>
  <th>Action</th>
</tr>
<% @treatments.each do |treatment| %>
  <tr align=center>
    <td><%= treatment.Drug.name %></td>
    <td><%= treatment.daily_pills %></td>
    <td><%= treatment.debut_date %></td>
    <td><%= treatment.until %></td>
    <td><%= link_to 'Edit', edit_treatment_path(treatment) %> </td>
  </tr>
<% end %>
</table>


<h2> Images <%= link_to 'add image', new_image_path(:patient_id => @patient.id) %></h2>
<table border=1>
<tr>
  <th>Notes</th>
  <th>Date taken</th>
  <th>Date uploaded</th>
</tr>
<% @patient.Images.each do |image| %>
  <tr>
    <td><%= link_to image.notes, image_path(image.id) %></td>
    <td><%= image.date_taken %> </td>
    <td><%= image.created_at %> </td>
  </tr>
<% end %>

</center>

<%= link_to 'Back', clinics_path %>
